package com.lapian.designmode.observer;

/**
 * 创建日期：2021/11/12 10:50
 *
 * @author tony.sun
 * 类说明：实时数据天气
 */

public class WeatherDate {
    private CurrentConditions currentConditions;
    // TODO: 2021/11/16
    private ZhangShangApp zhangShangApp;

    private float temperature;
    private float pressure;
    private float humidity;

    public float getTemperature() {
        return temperature;
    }

    public float getPressure() {
        return pressure;
    }

    public float getHumidity() {
        return humidity;
    }

    public WeatherDate(CurrentConditions currentConditions,ZhangShangApp zhangShangApp) {
        this.currentConditions=currentConditions;
        this.zhangShangApp=zhangShangApp;
    }

    public void setData(float temperature, float pressure, float humidity) {
        this.temperature=temperature;
        this.pressure=pressure;
        this.humidity=humidity;
        dateChange();
    }

    private void dateChange() {
        currentConditions.update(getTemperature(),getPressure(),getHumidity());
        zhangShangApp.update(getTemperature(),getPressure(),getHumidity());
    }
}
